// Copyright (c) 2024 CHANGLEI. All rights reserved.

import 'package:charts_grasp/src/chart/common/data_label.dart';
import 'package:charts_grasp/src/chart/utils/enum.dart';
import 'package:charts_grasp/src/circular_chart/renderer/chart_point.dart';
import 'package:charts_grasp/src/circular_chart/renderer/renderer_base.dart';
import 'package:charts_grasp/src/common/common.dart';
import 'package:charts_grasp/src/common/user_interaction/selection_behavior.dart';
import 'package:charts_grasp/src/common/utils/enum.dart';
import 'package:charts_grasp/src/common/utils/typedef.dart';
import 'package:flutter/material.dart';

class ChartSeries<T, D> {
  const ChartSeries({
    this.xValueMapper,
    this.yValueMapper,
    this.dataLabelMapper,
    this.name,
    this.dataSource,
    this.pointColorMapper,
    this.sortFieldValueMapper,
    bool? enableTooltip,
    this.emptyPointSettings,
    this.dataLabelSettings,
    this.animationDuration,
    this.borderColor,
    this.borderWidth,
    this.selectionBehavior,
    this.legendItemText,
    this.legendIconType,
    this.opacity,
    this.sortingOrder,
    this.animationDelay,
    this.isVisible,
  }) : enableTooltip = enableTooltip ?? true;

  final List<T>? dataSource;

  final ChartIndexedValueMapper<D>? xValueMapper;

  final ChartIndexedValueMapper<dynamic>? yValueMapper;

  final ChartIndexedValueMapper<Color>? pointColorMapper;

  final ChartIndexedValueMapper<String>? dataLabelMapper;

  final EmptyPointSettings? emptyPointSettings;

  final DataLabelSettings? dataLabelSettings;

  final String? name;

  final bool enableTooltip;

  final double? animationDuration;

  final Color? borderColor;

  final double? borderWidth;

  final String? legendItemText;

  final LegendIconType? legendIconType;

  final SelectionBehavior? selectionBehavior;

  final double? opacity;

  final ChartIndexedValueMapper<dynamic>? sortFieldValueMapper;

  final SortingOrder? sortingOrder;

  final bool? isVisible;

  final double? animationDelay;
}

abstract class CircularChartEmptyPointBehavior {
  void calculateEmptyPointValue(
    int pointIndex,
    ChartPoint<dynamic> currentPoint,
    CircularSeriesRenderer seriesRenderer,
  );
}

abstract class TriangularChartEmptyPointBehavior {
  void calculateEmptyPointValue(int pointIndex, dynamic currentPoint, dynamic seriesRenderer);
}
